package log720.lab1;

/**
 * A very simple implementation of a 2-D grid
 */
import ca.etsmtl.log720.lab1.InfractionPOA;

public class InfractionsImpl extends InfractionPOA{
	
	private Infraction inf;
  private ArrayList<Infraction> infList = new ArrayList<Infraction>();
  
  private class Infraction
  {
    private int id;
    private String description;
    private int niveau;
    
    public Infraction(int id, String description, int niveau)
    {
      this.id = id;
      this.description = description;
      
      /*
      if (niveau == ???)
        throw NiveauHorsBornesException();
      */
        
      
      this.niveau = niveau;
    }
    
    public int getId()
    {
      return id;
    }
    
    public String getDescription()
    {
      return description;
    }
    
    public int getNiveau()
    {
      return niveau;
    }
    
    public String toString()
    {
      return getDescription();
    }
  }
	
	public InfractionsImpl() 
	{
		
	}
  
  public void addInfraction(int id, String description, int niveau)
  {
    inf = new Infraction(id, description, niveau);
    this.id = id;
    this.description = description;
    this.niveau = niveau;
    infList.add(inf);
  }

	public Infraction getInfraction(int index)
  {
    return infList.get(index);
  }
  
  public int getInfractionListSize()
  {
    return infList.size();
  }
}
